<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
	<title>子类重载父类的方法</title>
</head>
<body>
<?php 
class Person 
{

	protected $name;
	protected $age;
	protected $sex;
	function __construct($name,$age=20,$sex="男"){
		$this->name=$name;
		$this->age=$age;
		$this->sex=$sex;

	}
	
	function say(){
		echo "我的名字是".$this->name."我的年龄是"
		.$this->age."我的性别是".$this->sex."<br>";

					}


	
}
class student extends Person{
var $school;
function __construct( $name,$age,$sex,$school){
	parent::__construct($name,$age,$sex);
	$this->school=$school;
}
function study(){
	echo $this->name."正在".$this->school."学习"."<br>";
}
function say(){
	parent::say();
	echo "我正在".$this->school."学习"."<br>";
	}
}
$stu1=new student("zhangsan","23","男","清华");
$stu1->say();

 ?>


</body>
</html>